#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;

int num1[650], num2[650];
int Length = 0;
const int PARTWIDTH = 8;
const int PARTSCALE = 100000000;
string num1_in_string, num2_in_string;

void pressIntoIntArray(string str1,string str2);
int* DivideAndConquer(int* A, int* B, int length);
void clearAll(void);
void output(int* array, int length);

int main()
{
	int n = 0;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> num1_in_string >> num2_in_string;
		pressIntoIntArray(num1_in_string,num2_in_string);
		int* result = DivideAndConquer(num1, num2, Length);
		int startpos = 0;
		for (int i = 2 * Length - 1; i >= 0; i--)
		{
			if (result[i] != 0) { startpos = i; break; }
		}
		cout << result[startpos];
		for (int i = startpos-1; i >= 0; i--)
		{
			cout << setw(8) << setfill('0') << result[i];
		}
		cout << endl;
		clearAll();
	}
	return 0;
}

void clearAll(void)
{
	num1_in_string.clear();
	num2_in_string.clear();
	for (int i = 0; i < Length; i++)
	{
		num1[i] = 0; num2[i] = 0;
	}
	Length = 0;
}

void pressIntoIntArray(string str1,string str2)
{
	if (str1.size() >= str2.size())
	{
		for (int a = (int)str1.size(); a > 0; a -= PARTWIDTH)
		{
			int b = max(0, a - PARTWIDTH);
			string tmp = str1.substr(b, (long long)a - (long long)b);
			num1[Length] = stoi(tmp);
			Length++;
		}
		int i = 0;
		for (int a = (int)str2.size(); a > 0; a -= PARTWIDTH)
		{
			int b = max(0, a - PARTWIDTH);
			string tmp = str2.substr(b, (long long)a - (long long)b);
			num2[i] = stoi(tmp);
			i++;
		}
	}
	else
	{
		for (int a = (int)str2.size(); a > 0; a -= PARTWIDTH)
		{
			int b = max(0, a - PARTWIDTH);
			string tmp = str2.substr(b, (long long)a - (long long)b);
			num2[Length] = stoi(tmp);
			Length++;
		}
		int i = 0;
		for (int a = (int)str2.size(); a > 0; a -= PARTWIDTH)
		{
			int b = max(0, a - PARTWIDTH);
			string tmp = str1.substr(b, (long long)a - (long long)b);
			num1[i] = stoi(tmp);
			i++;
		}
	}
}

int* DivideAndConquer(int* A, int* B, int length)
{
	if (length <= 1)
	{
		int* part_result = new int[(long long)2 * (long long)length+2];
		for (int i = 0; i < 2 * length+2; i++)
		{
			part_result[i] = 0;
		}
		for (int i = 0; i < length; i++)
		{
			for (int j = 0; j < length; j++)
			{
				long long num = (long long)part_result[i + j] + (long long)A[i] * (long long)B[j];
				part_result[i + j] = num % PARTSCALE;
				part_result[i + j + 1] += num / PARTSCALE;
			}
		}
		return part_result;
	}
	else
	{
		int* part_result = new int[(long long)2 * (long long)length+2];
		for (int i = 0; i < 2 * length+2; i++)
		{
			part_result[i] = 0;
		}
		//int mid = 0;
		int mid = (length - 1) / 2 + 1;
		int* a2b2 = DivideAndConquer(A, B, mid);//(a2*b2)
		int* a1b1 = DivideAndConquer(A + mid, B + mid, length - mid);//(a1*b1)

		for (int i = 0; i < length - mid; i++)
		{
			A[i] += A[i + mid];
			B[i] += B[i + mid];
		}
		/*int* a1a2 = new int[mid + 2];
		for (int i = 0; i < mid + 1; i++)
		{
			a1a2[i] = 0;
		}
		for (int i = 0; i < length - mid; i++)
		{
			a1a2[i] += A[i] + A[i + mid];
			a1a2[i + 1] += a1a2[i] / PARTSCALE;
			a1a2[i] %= PARTSCALE;
		}
		for (int i = length - mid; i < mid; i++)
		{
			a1a2[i] += A[i];
		}
		int* b1b2 = new int[mid + 2];
		for (int i = 0; i < mid + 1; i++)
		{
			b1b2[i] = 0;
		}
		for (int i = 0; i < length - mid; i++)
		{
			b1b2[i] += b[i] + b[i + mid];
			b1b2[i + 1] += b1b2[i] / PbRTSCbLE;
			b1b2[i] %= PbRTSCbLE;
		}
		for (int i = length - mid; i < mid; i++)
		{
			b1b2[i] += b[i];
		}*/
		int* a1a2b1b2 = DivideAndConquer(A, B, mid);//(a1+a2)*(b1+b2)
		for (int i = 0; i <= 2 * mid; i++) //(-a2b2)
		{ 
			if (a1a2b1b2[i] >= a2b2[i])
			{
				a1a2b1b2[i] -= a2b2[i];
			}
			else
			{
				a1a2b1b2[i + 1]--;
				a1a2b1b2[i] = a1a2b1b2[i] - a2b2[i] + PARTSCALE;
			}
		}
		for (int i = 0; i <= 2 * (length - mid); i++) //(-a1b1)
		{ 
			if (a1a2b1b2[i] >= a1b1[i])
			{
				a1a2b1b2[i] -= a1b1[i];
			}
			else
			{
				a1a2b1b2[i + 1]--;
				a1a2b1b2[i] = a1a2b1b2[i] - a1b1[i] + PARTSCALE;
			}
		}

		for (int i = 0; i < length - mid; i++)
		{
			A[i] -= A[i + mid];
			B[i] -= B[i + mid];
		}

		for (int i = 0; i <= 2 * mid; i++) 
		{ 
			int num = part_result[i] + a2b2[i];
			part_result[i] = num % PARTSCALE;
			part_result[i + 1] += num / PARTSCALE;
		}
		for (int i = 0; i <= 2 * mid+1; i++) 
		{ 
			int num = part_result[i+mid] + a1a2b1b2[i];
			part_result[i+mid] = num % PARTSCALE;
			part_result[i + 1+mid] += num / PARTSCALE;
		}
		for (int i = 0; i <= 2 * (length - mid); i++) 
		{ 
			int num = part_result[i+mid*2] + a1b1[i];
			part_result[i+mid*2] = num % PARTSCALE;
			part_result[i + 1+mid*2] += num / PARTSCALE;
		}

		delete[] a1b1;
		delete[] a2b2;
		delete[] a1a2b1b2;

		output(A, length);
		cout << "*" << endl;
		output(B, length);
		cout << "=" << endl;
		output(part_result, 2 * length + 2);
		cout << length << endl << endl;

		return part_result;
	}
}

void output(int* array, int length)
{
	cout << array[length-1];
	for (int i = length-2; i >=0; i--)
	{
		cout << setw(8) << setfill('0') << array[i];
	}
	cout << endl;
}
